//http://wrhrcdn.etouch.cn/weather_mini
// get 参数 city
// https://api.openweathermap.org/data/2.5/forecast?q=Beijing,cn&appid=800f49846586c3ba6e7052cfc89af16c

var app = new Vue({
    el:"#app",
    data:{
        city: "dongguan", 
        weatherList:[],
    },
    methods:{
        updata:function(){
            var that = this;
            axios.get(`https://api.openweathermap.org/data/2.5/forecast?q=${this.city},cn&appid=800f49846586c3ba6e7052cfc89af16c`)
                .then(function(response){
                    // console.log(`${Math.floor(response.data.list[0].main.temp - 272.15)}℃`);
                    console.log(response);
                    that.weatherList = response.data.list.filter((x,i)=>{
                        if(i%8===0){
                            return 1;
                        }
                        return 0;
                    });
                })
                .catch(function(err){
                    console.log(err);
                })
        },
        changeCity:function(city){
            this.city = city;
            this.updata();
        }

    }
});
